<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
>
<head>
    <meta charset="UTF-8">
    <title>后台管理-登陆</title>
    <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
    <meta content="*" http-equiv="Access-Control-Allow-Origin">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1" name="viewport">
    <meta content="black" name="apple-mobile-web-app-status-bar-style">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="telephone=no" name="format-detection">
    <link href="/URMS/lib/layui-v2.5.5/css/layui.css" media="all" rel="stylesheet">
    <!--    <link href="../../../static/URMS/lib/layui-v2.5.5/css/layui.css" media="all" rel="stylesheet">-->

    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <style>
        body {
            background-image: url("images/bg.jpg");
            height: 100%;
            width: 100%;
        }

        #container {
            height: 100%;
            width: 100%;
        }

        input:-webkit-autofill {
            -webkit-box-shadow: inset 0 0 0 1000px #fff;
            background-color: transparent;
        }

        .admin-login-background {
            width: 300px;
            height: 300px;
            position: absolute;
            left: 50%;
            top: 40%;
            margin-left: -150px;
            margin-top: -100px;
        }

        .admin-header {
            text-align: center;
            margin-bottom: 20px;
            color: #ffffff;
            font-weight: bold;
            font-size: 40px
        }

        .admin-input {
            border-top-style: none;
            border-right-style: solid;
            border-bottom-style: solid;
            border-left-style: solid;
            height: 50px;
            width: 300px;
            padding-bottom: 0px;
        }

        .admin-input::-webkit-input-placeholder {
            color: #a78369
        }

        .layui-icon-username {
            color: #a78369 !important;
        }

        .layui-icon-username:hover {
            color: #9dadce !important;
        }

        .layui-icon-password {
            color: #a78369 !important;
        }

        .layui-icon-password:hover {
            color: #9dadce !important;
        }

        .admin-input-username {
            border-top-style: solid;
            border-radius: 10px 10px 0 0;
        }

        .admin-input-verify {
            border-radius: 0 0 10px 10px;
        }

        .admin-button {
            margin-top: 20px;
            font-weight: bold;
            font-size: 18px;
            width: 300px;
            height: 50px;
            border-radius: 5px;
            background-color: #a78369;
            border: 1px solid #d8b29f
        }

        .admin-icon {
            margin-left: 260px;
            margin-top: 10px;
            font-size: 30px;
        }

        i {
            position: absolute;
        }

        .admin-captcha {
            position: absolute;
            margin-left: 205px;
            margin-top: -40px;
        }
    </style>
</head>
<body>
<div id="container">
    <div></div>
    <div class="admin-login-background">
        <div class="admin-header">
            <span>layuimini</span>
        </div>
        <form action="" class="layui-form">
            <div>
                <i class="layui-icon layui-icon-username admin-icon"></i>
                <input autocomplete="off" class="layui-input admin-input admin-input-username" id="account"
                       name="account" placeholder="请输入用户名" type="text" value="jack">
            </div>
            <div>
                <i class="layui-icon layui-icon-password admin-icon"></i>
                <input autocomplete="off" class="layui-input admin-input" is="password" name="password"
                       placeholder="请输入密码" type="password" value="123456">
            </div>
            <button class="layui-btn admin-button" lay-filter="login" lay-submit type="button">登 陆</button>
        </form>
    </div>
</div>
<script charset="utf-8" src="/URMS/lib/layui-v2.5.5/layui.js"></script>
<script charset="utf-8" src="/URMS/lib/jquery-3.4.1/jquery-3.4.1.min.js"></script>
<script>
    layui.use(['form'], function () {
        var form = layui.form,
            layer = layui.layer;

        // 登录过期的时候，跳出ifram框架
        // if (top.location != self.location) top.location = self.location;

        // 进行登录操作
        form.on('submit(login)', function (data) {
            let user = data.field;

            if (user.account == '') {
                layer.msg('用户名不能为空');
                return false;
            }
            if (user.password == '') {
                layer.msg('密码不能为空');
                return false;
            }

            $.ajax({
                url: "/URMS/sysUser/loginSubmit",
                data: user,
                type: "POST",
                async: false,
                dataType: "JSON",
                error: function (XMLHttpResponse) {
                    layer.msg("登录出错");
                },
                success: function (data) {
                    if (data == null) {
                        layer.msg("登录失败");
                        return false
                    } else {
                        layer.msg("登录中，请稍等...")
                        // sessionStorage.setItem("loginUser", JSON.stringify(data));
                        window.location.href = "index";
                    }
                }

            })


        });
    });
</script>
</body>
</html>